<template>
  <div>
      
      <van-nav-bar
      title="新闻详情"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft" />
      <van-swipe-cell v-for="item in newlist" :key="item.id">
      <van-list
      v-model="loading"
      :title="item.title"
      />
      </van-swipe-cell>
  </div>
</template>

<script>
import axios from "axios";
export default {
    data(){
        
        return{
newlist:[],
        }
    },
    created() {
      axios
        .get("/api/allnews.php")
        .then((response) => {
          this.cartlist = response.data.data;
        })
        .catch(function (error) {
          // handle error
          console.log(error);
        });
    },
methods:{


     onLoad() {
      // 异步更新数据
      // setTimeout 仅做示例，真实场景中一般为 ajax 请求
      setTimeout(() => {
        for (let i = 0; i < 0; i++) {
          this.list.push(this.list.length + 1);
        }

        // 加载状态结束
        this.loading = false;

        // 数据全部加载完成
        if (this.list.length >= 0) {
          this.finished = true;
        }
      }, 1000);
    },
     onClickLeft() {
     
      this.$router.go(-1);
    },
}
}
</script>

<style>

</style>